package com.ys.nms.module.business.dal.mysql.devices;

import com.ys.nms.framework.common.pojo.PageResult;
import com.ys.nms.framework.mybatis.core.mapper.BaseMapperX;
import com.ys.nms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ys.nms.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.ys.nms.module.business.controller.admin.devices.vo.DevicesPageReqVO;
import com.ys.nms.module.business.dal.dataobject.devices.DevicesDO;
import com.ys.nms.module.business.dal.dataobject.processors.ProcessorsDO;
import com.ys.nms.module.business.dal.dataobject.storage.StorageDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface DevicesMapper extends BaseMapperX<DevicesDO> {

    default PageResult<DevicesDO> selectPage(DevicesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DevicesDO>()
                .likeIfPresent(DevicesDO::getHostname, reqVO.getHostname())
                .eqIfPresent(DevicesDO::getDisplay, reqVO.getDisplay())
                .eqIfPresent(DevicesDO::getSnmpDisable, reqVO.getSnmpDisable())
                .eqIfPresent(DevicesDO::getStatus, reqVO.getStatus())
                .orderByDesc(DevicesDO::getDeviceId));
    }

}